package com.ardrone.vol;

import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;

public class Decollage extends Thread 
{
				
@Override public void run()
		{
			
	        int port = 5556;
	        String envoiMessage= "AT*CONFIG=1,\"control:altitude_max\",\"2000\"\rAT*FTRIM\rAT*REF=3,290718208\r";
	        int taille = envoiMessage.length();
	        byte[] message = new byte[taille];
	        message = envoiMessage.getBytes();
	        byte[] ip = {(byte)192, (byte)168, (byte)1, (byte)1 };
	        
	        
	        try { 
	            DatagramSocket socket = new DatagramSocket();
	            InetAddress address = InetAddress.getByAddress(ip);
	            DatagramPacket packet = new DatagramPacket(message, taille, address, port); 
	            socket.send(packet);
	            socket.close();
	            }
	        catch (Exception e) 
	        {
	        	e.printStackTrace();
	        }
	 
	    }
}
